﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using YAPL.Language.Ast;
using YAPL.Util;

namespace YAPL.Language.SourceParser.XML.NodeParsers {
	public class XmlProgramDefParser : XmlExpressionParser {
		public XmlProgramDefParser(XmlInputParser inputParser) : base(inputParser) {}
		public override Expression ParseNode(XElement node) {
			//parse program body
			var bodyElement = node.Element(XmlNames.CodeBlockExpression);
			Require.NotNull(bodyElement);
			var programBody = (CodeBlockExpression) Parser.ParseNode(bodyElement);

			return Expressions.Program(programBody);
		}
	}
}
